<template>
  <el-dialog
    width="100%"
    :fullscreen="true"
    top="0"
    :title="this.title"
     class="label_font"
    v-loading.fullscreen.lock="submitLoading"
    :element-loading-text="this.tip"
    :close-on-click-modal="false"
    :visible.sync="visible">
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm"  label-width="190px">

    <el-row  >
      <el-col :span="12"   >
            <el-form-item label="抵押权人名称" prop="dyqrmc" class="label_font" >

                  <el-select
                    v-model="dataForm.dyqrmc"
                            :disabled="isInputDisabled()"
                    clearable
                    filterable
                    style="width:100%"
                    remote
                
                    placeholder="抵押权人名称"
                    :remote-method="remoteMethod2"
                    :loading="loading">
                    <el-option
                      v-for="item in list"
                      :key="item.branchid"
                      :label="item.branchname"
                      :value="item.branchid">
                    </el-option>
                  </el-select>

            </el-form-item>
      </el-col>

            <el-col :span="12">

        <el-form-item label="附记" prop="fj" class="label_font">
              <el-input v-model="dataForm.fj" placeholder="附记"  style="width:100%"  :disabled="isInputDisabled()"  ></el-input>
        </el-form-item>

      </el-col>

      <el-col :span="12" v-if="false">
          <el-form-item label="抵押权人类型" prop="dyqrlx" class="label_font">
            <el-select v-model="dataForm.dyqrlx" placeholder="抵押权人类型" 
             :disabled="isInputDisabled()"
              style="width:100%" >
            </el-select>
          </el-form-item>
      </el-col>
    </el-row>

    <el-row   >

      <el-col :span="12">
          <el-form-item label="抵押权人证件类型" prop="dyqrzjlx" class="label_font">
            <el-select v-model="dataForm.dyqrzjlx" placeholder="抵押权人证件类型"  
            :disabled="isInputDisabled()" 
             style="width:100%" 
            >
            </el-select>
          </el-form-item>
      </el-col>

      <el-col :span="12">
            <el-form-item label="抵押权人证件号码" prop="dyqrzjhm" class="label_font" >
              <el-input v-model="dataForm.dyqrzjhm" placeholder="抵押权人证件号码" :maxlength="18"  :disabled="isInputDisabled()"  style="100%"></el-input>
            </el-form-item>
      </el-col>

    </el-row>

    <el-row  >
      <el-col :span="12">

        <el-form-item label="地市" prop="seRegion">
          <el-select  @change="selectChanged" v-model="dataForm.seRegion" placeholder="地市" style="width:100%"
           :disabled="isInputDisabled()" >
              <el-option
                v-for="item in dataForm.seRegionList"
                :key="item.code"
                :label="item.name"
                :value="item.code">
              </el-option>
          </el-select>
        </el-form-item>
      </el-col>

      <el-col :span="12">
          <el-form-item label="区县" prop="region">
            <el-select @change="selectChanged2" v-model="dataForm.region" placeholder="区县" style="width:100%" :disabled="isInputDisabled()" >
                <el-option
                  v-for="item in dataForm.regionList"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code">
                </el-option>
            </el-select>
          </el-form-item>
      </el-col>
    </el-row>

    <el-row  >

      <el-col :span="12">
          <el-form-item label="抵押权人代理人电话" prop="dlrdh" class="label_font">
            <el-input v-model="dataForm.dlrdh" placeholder="回车自动回显代理人信息" 
              @keyup.enter.native="queryDyqr"
             :disabled="isInputDisabled()"  ></el-input>
          </el-form-item>
      </el-col>

      <el-col :span="12">
          <el-form-item label="抵押权人代理人名称" prop="dyrdlrmc" class="label_font">
            <el-input v-model="dataForm.dyrdlrmc" placeholder="抵押人代理人名称"  :disabled="isInputDisabled()"  ></el-input>
          </el-form-item>
      </el-col>
      <el-col :span="12">
          <el-form-item label="抵押权人代理人类型"  v-if="false" prop="dyrdlrlx" class="label_font">

            <el-select v-model="dataForm.dyrdlrlx" placeholder="抵押人代理人类型" style="width:100%"  :disabled="isInputDisabled()"  >
            </el-select>
          </el-form-item>
      </el-col>
    </el-row>

    <el-row  >
      <el-col :span="12">
          <el-form-item label="抵押权人代理人证件类型" prop="dyrdlrzjlx" class="label_font">
            <el-select v-model="dataForm.dyrdlrzjlx" placeholder="抵押人代理人证件类型" style="width:100%" :disabled="isInputDisabled()" >
            </el-select>
          </el-form-item>
      </el-col>
      <el-col :span="12">
          <el-form-item label="抵押权人代理人证件号码" prop="dyrdlrzjhm" class="label_font">
            <el-input v-model="dataForm.dyrdlrzjhm" placeholder="抵押人代理人证件号码" :maxlength="18" :disabled="isInputDisabled()" ></el-input>
          </el-form-item>
      </el-col>
    </el-row>



 


  <el-row >
      <el-col :span="12">
          <el-form-item label="债务人" prop="zwr" class="label_font">
            <el-input v-model="dataForm.zwr" placeholder="多人用/分隔" :disabled="isInputDisabled()" ></el-input>
          </el-form-item>
      </el-col>
      <el-col :span="12">
          <el-form-item label="债务履行开始日期" prop="zwbegintime" class="label_font">
            <el-date-picker v-model="dataForm.zwbegintime" placeholder="债务履行开始日期"  :disabled="isInputDisabled()"  format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width:100%" ></el-date-picker>
          </el-form-item>
      </el-col>
    </el-row>

    <el-row  >
      <el-col :span="12">
          <el-form-item label="主债权担保金额(万元)" prop="dbje" class="label_font">
            <el-input-number v-model="dataForm.dbje" style="width:100%;text-align:left" :precision="4" placeholder="主债权担保金额(万元)"  :disabled="isInputDisabled()" ></el-input-number>
          </el-form-item>
      </el-col>

      <el-col :span="12">
          <el-form-item label="债务履行结束日期" prop="zwendtime" class="label_font">
            <el-date-picker v-model="dataForm.zwendtime" placeholder="债务履行开始日期"  :disabled="isInputDisabled()"  format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width:100%" ></el-date-picker>
          </el-form-item>
      </el-col>

    </el-row>

    <el-row  >
      <el-col :span="12">
        <el-form-item label="办理点" prop="site" class="label_font">
          <el-select v-model="dataForm.site" placeholder="办理点" style="width:100%" :disabled="isInputDisabled()" >
                <el-option
                  v-for="item in dataForm.siteList"
                  :key="item.siteno"
                  :label="item.sitename"
                  :value="item.siteno">
                </el-option>
            </el-select>
        </el-form-item>
      </el-col>

      <el-col :span="12">
        <el-form-item label="领证方式" prop="gettype" class="label_font">
             <el-select v-model="dataForm.gettype" placeholder="领证方式" style="width:100%" :disabled="isInputDisabled()" >

            </el-select>
        </el-form-item>
      </el-col>

    </el-row>

        <el-row  >

      <el-col :span="12">
        <el-form-item label="带抵押过户标识" prop="dyghbs" class="label_font">
             <el-select v-model="dataForm.dyghbs" placeholder="带抵押过户标识" style="width:100%" :disabled="isInputDisabled()" >
                        <el-option
                        v-for="item in dataForm.dyghList"
                        :key="item.value"
                        :label="item.text"
                        :value="item.value">
                        </el-option>
            </el-select>
        </el-form-item>
      </el-col>
 
            <el-col :span="12">
                    <el-form-item label="抵押担保范围" prop="dbfw" class="label_font">
                        <el-input v-model="dataForm.dbfw" placeholder="抵押担保范围" :disabled="isInputDisabled()" ></el-input>
                    </el-form-item>   
            </el-col>
   
    </el-row>

    <el-row  >

            <el-col :span="12">
                <el-form-item label="抵押方式" prop="dyfs" class="label_font">
                    <el-select v-model="dataForm.dyfs" placeholder="抵押方式" style="width:100%"  :disabled="isInputDisabled()"  >
                        <el-option
                        :key="'0'"
                        :label="'一般抵押'"
                        :value="'0'" >
                        </el-option>
                        <el-option
                        :key="'1'"
                        :label="'最高额抵押'"
                        :value="'1'">
                        </el-option>
                    </el-select>
                </el-form-item>
            </el-col>

                    <el-col :span="12">
            <el-form-item label="是否电子归档件" prop="isdzyxyw"  class="label_font">
               <el-select v-model="dataForm.isdzyxyw" placeholder="是否电子归档件" style="width:100%"  :disabled="isInputDisabled()"  >
                        <el-option
                        :key="'0'"
                        :label="'否'"
                        :value="'0'" >
                        </el-option>
                        <el-option
                        :key="'1'"
                        :label="'是'"
                        :value="'1'">
                        </el-option>
               </el-select>
            </el-form-item>  
            </el-col>
    </el-row>

    <el-row v-if="isSumbitEnabled()">
      <el-col :span="12">
        <el-form-item label="审核结果" prop="checkresult" 
           :class="{ 'is-required': isSumbitEnabled() }"
          class="label_font" >
            <el-radio-group v-model="dataForm.checkresult"   >
               <el-radio label="1">审核通过</el-radio>
               <el-radio label="2">退回信息补正</el-radio>
               <el-radio label="3">退回资料补正</el-radio>
             </el-radio-group>
        </el-form-item>
      </el-col>

      <el-col :span="12">
        <el-form-item label="审核不通过理由" prop="rejectreason" class="label_font"
         :class="{ 'is-required': isSumbitEnabled() && dataForm.checkresult == 2  || dataForm.checkresult == 3}"
         v-if="isSumbitEnabled() && (dataForm.checkresult == 2 || dataForm.checkresult == 3)">
          <el-input v-model="dataForm.rejectreason" placeholder="审核不通过理由" ></el-input>
        </el-form-item>
      </el-col>
    </el-row> 


    <el-row  >
      <el-col :span="12">
          <el-row align="center" justify="center" >
              <el-col :span="24">

                  <div class="xwbl cell_border">抵押权人询问笔录</div>
              </el-col>
          </el-row>
          <el-row>
                <el-col :span="12" class="xwbl_item cell_border">是否为真实意思表示 ？</el-col>
                <el-col :span="12" class="xwbl_item cell_border">
                                 <el-radio-group v-model="dataForm.left1"  :disabled="isInputDisabled()" >
               <el-radio label="1">是</el-radio>
               <el-radio label="0">否</el-radio>
             </el-radio-group>
                </el-col>
          </el-row>
                    <el-row>
                <el-col :span="12" class="xwbl_item cell_border">是否为共有房屋 ？</el-col>
                <el-col :span="12" class="xwbl_item cell_border">
                                 <el-radio-group v-model="dataForm.left2" :disabled="isInputDisabled()" >
               <el-radio label="1">是</el-radio>
               <el-radio label="0">否</el-radio>
             </el-radio-group>
                </el-col>
          </el-row>

          <el-row >
                <el-col :span="12" class="xwbl_item cell_border">&nbsp;</el-col>
                <el-col :span="12" class="xwbl_item cell_border">
                    &nbsp;
                </el-col>
          </el-row>
          <el-row >
                <el-col :span="12" class="xwbl_item cell_border">&nbsp;</el-col>
                <el-col :span="12" class="xwbl_item cell_border">&nbsp;
                </el-col>
          </el-row>
      </el-col>
      <el-col :span="12">
          <el-row>
              <el-col :span="24">

                  <div class="xwbl cell_border">抵押人询问笔录</div>
              </el-col>
          </el-row>
                    <el-row>
                <el-col :span="12" class="xwbl_item cell_border">是否为真实意思表示 ？</el-col>
                <el-col :span="12" class="xwbl_item cell_border">
                                 <el-radio-group v-model="dataForm.right1" :disabled="isInputDisabled()" >
               <el-radio label="1">是</el-radio>
               <el-radio label="0">否</el-radio>
             </el-radio-group>
                </el-col>
          </el-row>


           <el-row>
                <el-col :span="12" class="xwbl_item cell_border">是否为共有房屋 ？</el-col>
                <el-col :span="12" class="xwbl_item cell_border">
                <el-radio-group v-model="dataForm.right2" :disabled="isInputDisabled()" >
               <el-radio label="1">是</el-radio>
               <el-radio label="0">否</el-radio>
                    </el-radio-group>
                </el-col>
          </el-row>

          <el-row >
                <el-col :span="12" class="xwbl_item cell_border">是否证件遗失 ？</el-col>
                <el-col :span="12" class="xwbl_item cell_border">
            <el-radio-group v-model="dataForm.right3" :disabled="isInputDisabled()" >
               <el-radio label="1">是</el-radio>
               <el-radio label="0">否</el-radio>
             </el-radio-group>
                </el-col>
          </el-row>
          <el-row >
                <el-col :span="12" class="xwbl_item cell_border">是否证件一致 ？</el-col>
                <el-col :span="12" class="xwbl_item cell_border">
                                 <el-radio-group v-model="dataForm.right4"  >
               <el-radio label="1" :disabled="isInputDisabled()">是</el-radio>
               <el-radio label="0" :disabled="isInputDisabled()">否</el-radio>
             </el-radio-group>
                </el-col>
          </el-row>

      </el-col>
    </el-row>
    <el-row >
<el-col>
  <div>

        <table width='100%' border="1"  cellspacing="0" v-if="dataForm.dyfs == '1' && application == 1">
                                        <tr>
                                            <td rowspan="9" align="center"><b>待上传材料:</b></td>
                                        </tr>
                                        <tr>

                                            <td>文件编码30：经办人（代理人）手写签名电子图片文件） <font color="red"><b>*</b></font></td>
                                            <td>
                                                 <div style="width:300px;"></div>                                               
                                                <el-upload :action="url" 
                                                  ref="upload30"
                                                  :on-success="successHandle30"
                                                  :before-upload="beforeUploadHandle"  
                                                  :file-list="fileList30"
                                                  :show-file-list="true"
                                                  :on-preview="handlePreview"
                                                  accept="image/png,image/jpg,image/jpeg"
                                                  :disabled="isFileDisabled()"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'30'}"
                                                  :before-remove="beforeRemove30"
                                                  :on-remove="removeFile"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary" v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>文件编码02：申请人身份证明材料（提供抵押人身份证明材料 ，或 抵押人出具的委托公证书） <font
                                                    color="red"><b>*</b></font>                                                   

                                                    </td>
                                            <td>
                                                <el-upload :action="url" 
                                          
                                                  :on-success="successHandle3"
                                                  ref="upload2"
                                                     v-if="value1"  
                                                  :file-list="fileList3"
                                                  accept=".PDF,.pdf"
                                                  :disabled="isFileDisabled()"
                                                  :on-preview="handlePreview"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'02'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile02"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>



                                            </td>
                                        </tr>
                                        
                                                                                <tr>
                                            <td>文件编码03：不动产权证书 <font color="red"><b>*</b></font></td>
                                            <td>
                                                                                                <el-upload :action="url" 
                                          
                                                  :on-success="successHandle3"
                                                  ref="upload3"
                                                  :file-list="fileList3"
                                                  :disabled="isFileDisabled()"
                                                  :show-file-list="true"
                                                  accept=".PDF,.pdf"
                                                  :on-preview="handlePreview"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'03'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile03"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td>文件编码07：主债权合同<font color="red"><b>*</b></font>
                                            </td>
                                            <td>
                                            
                                            <el-upload :action="url" 
                                                  ref="upload7"
                                                  :on-success="successHandle7"
                                                  :on-preview="handlePreview" 
                                                  :disabled="isFileDisabled()"  
                                                  :file-list="fileList7"
                                                  accept=".PDF,.pdf"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'07'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile07"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            
                                            </td>
                                        </tr>


                                        <tr>
                                            <td>文件编码04：抵押合同(使用简版合同后不用上送)  </td>
                                            <td>

                                                  <el-upload :action="url" 
                                                  ref="upload5"
                                                  :on-success="successHandle5"
                                                  :file-list="fileList5"
                                                  :disabled="isFileDisabled()"
                                                  :on-preview="handlePreview"
                                                  accept=".PDF,.pdf"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'05'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>

                                            </td>
                                        </tr>

                                        <tr>
                                            <td>文件编码08：股东会或董事会决议（股份有限公司、有限责任公司应 提交）；上级主管部门批文（全民所有制企业应提交）；职工（代表）大会决议（集体所有制企业应提交）
                                            </td>
                                            <td>
                                            
                                            <el-upload :action="url" 
                                                  ref="upload8"
                                                  :on-success="successHandle2"
                                                  :file-list="fileList2"
                                                  :disabled="isFileDisabled()"
                                                  accept=".PDF,.pdf"
                                                  :on-preview="handlePreview"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'08'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile08"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            
                                            </td>
                                        </tr>


                                    </table>

    <table width='100%' border="1"  cellspacing="0" v-if="dataForm.dyfs == '0' && application == 1">
                                        <tr>
                                            <td rowspan="9" align="center"><b>待上传材料:</b></td>
                                        </tr>
                                        <tr>

                                            <td>文件编码30：经办人（代理人）手写签名电子图片文件） <font color="red"><b>*</b></font></td>
                                            <td>
                                                 <div style="width:300px;"></div>                                               
                                                <el-upload :action="url" 
                                                  ref="upload30"
                                                  :before-upload="beforeUploadHandle"
                                                  :on-success="successHandle30"
                                                  :file-list="fileList30"
                                                  :disabled="isFileDisabled()"
                                                  :on-preview="handlePreview"
                                                  :show-file-list="true"
                                                  accept="image/png,image/jpg,image/jpeg"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'30'}"
                                                  :before-remove="beforeRemove30"
                                                  :on-remove="removeFile30"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>文件编码03：申请人身份证明材料（提供抵押人身份证明材料 ，或 抵押人出具的委托公证书） <font
                                                    color="red"><b>*</b></font>
                                                    

                                                    </td>
                                            <td>
                                                                                                <el-upload :action="url" 
                                          
                                                  :on-success="successHandle3"
                                                  ref="upload3"
                                                     v-if="value1"  
                                                  :file-list="fileList3"
                                                  :disabled="isFileDisabled()"
                                                  :on-preview="handlePreview"
                                                  :show-file-list="true"
                                                  accept=".PDF,.pdf"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'03'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile03"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>



                                            </td>
                                        </tr>
                                        
                                        <tr>
                                            <td>文件编码04：不动产权证书 <font color="red"><b>*</b></font></td>
                                            <td>
                                                                                                <el-upload :action="url" 
                                          
                                                  :on-success="successHandle4"
                                                  ref="upload4"
                                                  :file-list="fileList4"
                                                  :disabled="isFileDisabled()"
                                                  :on-preview="handlePreview"
                                                  accept=".PDF,.pdf"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'04'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile04"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td>文件编码07：主债权合同<font color="red"><b>*</b></font>
                                            </td>
                                            <td>
                                            
                                            <el-upload :action="url" 
                                                  ref="upload7"
                                                  :on-success="successHandle7"
                                                  
                                                  :on-preview="handlePreview"   
                                                  :file-list="fileList7"
                                                  :disabled="isFileDisabled()"  
                                                  accept=".PDF,.pdf"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'07'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile07"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            
                                            </td>
                                        </tr>

                                        <tr>
                                            <td>文件编码02：股东会或董事会决议（股份有限公司、有限责任公司应 提交）；上级主管部门批文（全民所有制企业应提交）；职工（代表）大会决议（集体所有制企业应提交）
                                            </td>
                                            <td>
                                            
                                            <el-upload :action="url" 
                                                  ref="upload2"
                                                  :on-success="successHandle2"
                                                  :file-list="fileList2"
                                                  :disabled="isFileDisabled()"
                                                  :on-preview="handlePreview"
                                                  accept=".PDF,.pdf"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'02'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile02"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            
                                            </td>
                                        </tr>

                                        <tr>
                                            <td>文件编码05：抵押合同(使用简版合同后不用上送)  </td>
                                            <td>

                                                  <el-upload :action="url" 
                                                  ref="upload5"
                                                  :on-success="successHandle5"
                                                  :disabled="isFileDisabled()"
                                                  :on-preview="handlePreview"
                                                  :file-list="fileList5"
                                                  accept=".PDF,.pdf"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'05'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile05"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>

                                            </td>
                                        </tr>

                                        <tr v-if="false">
                                            <td>文件编码06：同一房产再次办理抵押知晓函
                                            </td>
                                            <td>
                                                  <el-upload :action="url" 
                                                  ref="upload6"
                                                  :on-success="successHandle6"
                                                  :disabled="isFileDisabled()"
                                                  :on-preview="handlePreview" 
                                                  :file-list="fileList6"
                                                  accept=".PDF,.pdf"
                                                  :show-file-list="true"

                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'06'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile06"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>


                                    </table>

    <table width='100%' border="1"  cellspacing="0" v-if="dataForm.dyfs == '0' && application == 0">
                                        <tr>
                                            <td rowspan="9" align="center" width="80px"><b>待上传材料:</b></td>
                                        </tr>
                                        <tr>

                                            <td>文件编码01：不动产抵押权登记申请书，需签字（签章） <font color="red"><b>*</b></font></td>
                                            <td>
                                                 <div style="width:300px;"></div>                                               
                                                <el-upload :action="url" 
                                                  ref="upload1"
                                                  multiple
                                                  :on-success="successHandle1"
                                                  :file-list="fileList1"
                                                  :before-upload="beforeUpload"
                                                  :accept="filetype()"
                                                  :show-file-list="true"
                                                  :disabled="isFileDisabled()"
                                                  :on-preview="handlePreview"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'01'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile01"
                                                  
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>文件编码03：未备案申请人身份证明材料（抵押人出具的委托公证书等） <font
                                                    color="red"><b>*</b></font>
    
                                                    
                                                    </td>
                                            <td>
                                                                                                <el-upload :action="url" 
                                          
                                                  :on-success="successHandle3"
                                                  ref="upload3"
                                                     v-if="value1"  
                                                  :file-list="fileList3"
                                                  multiple
                                                   :before-upload="beforeUpload"
                                                  :accept="filetype()"
                                                  :show-file-list="true"
                                       
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'03'}"
                                                  :before-remove="beforeRemove"
                                                  :disabled="isFileDisabled()"
                                                  :on-preview="handlePreview"
                                                  :on-remove="removeFile03"
                                                  
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>



                                            </td>
                                        </tr>
                                        <tr>
                                            <td>文件编码04：不动产权证书 <font color="red"><b>*</b></font></td>
                                            <td>
                                               <el-upload :action="url" 
                                          
                                                  :on-success="successHandle4"
                                                  ref="upload4"
                                                  :file-list="fileList4"
                                                  multiple
                                                   :before-upload="beforePicUpload"
                                                  :accept="pictype()"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :on-preview="handlePreview"
                                                  :disabled="isFileDisabled()"
                                                  :data="{seqno:this.seqno, fileCode:'04'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile04"
                                                  
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>
                                        

                                        <tr>
                                            <td>文件编码07：主债权合同（未备案的合同页或简版抵押合同）<font color="red"><b>*</b></font>
                                            </td>
                                            <td>
                                            
                                            <el-upload :action="url" 
                                                  ref="upload7"
                                                  :on-success="successHandle7"
                                                  :file-list="fileList7"
                                                  multiple
                                                   :before-upload="beforeUpload"
                                                  :accept="filetype()"
                                                  :disabled="isFileDisabled()"  
                                                  :show-file-list="true"
                                                  :on-preview="handlePreview" 
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'07'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile07"
                                                  
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            
                                            </td>
                                        </tr>

                                        <tr>
                                            <td>文件编码02：股东会或董事会决议（股份有限公司、有限责任公司应 提交）；上级主管部门批文（全民所有制企业应提交）；职工（代表）大会决议（集体所有制企业应提交）
                                            </td>
                                            <td>
                                            
                                            <el-upload :action="url" 
                                                  ref="upload2"
                                                  :on-success="successHandle2"
                                                  :file-list="fileList2"
                                                  multiple
                                                  :before-upload="beforePicUpload"
                                                  :accept="pictype()"
                                                  :show-file-list="true"
                                                  :on-preview="handlePreview"
                                                  :disabled="isFileDisabled()"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'02'}"
                                                  :before-remove="removeFile02"
                                                  :on-remove="removeFile02"
                                               
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            
                                            </td>
                                        </tr>

                                        <tr>
                                            <td>文件编码05：抵押合同（使用简版合同后不用上送）  </td>
                                            <td>

                                                  <el-upload :action="url" 
                                                  ref="upload5"
                                                  :on-success="successHandle5"
                                                  :file-list="fileList5"
                                                  multiple
                                                   :before-upload="beforeUpload"
                                                  :accept="filetype()"
                                                  :on-preview="handlePreview"
                                                  :disabled="isFileDisabled()"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'05'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile05"
                                                 
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>

                                            </td>
                                        </tr>

                                        <tr>
                                            <td>文件编码06：同一房产再次办理抵押知晓函
                                            </td>
                                            <td>
                                                  <el-upload :action="url" 
                                                  ref="upload6"
                                                  :on-success="successHandle6"
                                                  :on-preview="handlePreview"
                                                  :disabled="isFileDisabled()"
                                                  :file-list="fileList6"
                                                  multiple
                                                  :before-upload="beforePicUpload"
                                                  :accept="pictype()"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'06'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile06"
                                                  
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>


                                    </table>


        <table width='100%' border="1"  cellspacing="0" v-if="dataForm.dyfs == '1' && application == 0">
                                        <tr>
                                            <td rowspan="10" align="center" width="80px"><b>待上传材料:</b></td>
                                        </tr>
                                        <tr>

                                            <td>文件编码01：不动产抵押权登记申请书，需签字（签章） <font color="red"><b>*</b></font></td>
                                            <td>
                                                 <div style="width:300px;"></div>                                               
                                                <el-upload :action="url" 
                                                  ref="upload1"
                                                  :on-success="successHandle1"
                                                  :file-list="fileList1"
                                                  multiple
                                                  :before-upload="beforeUpload"
                                                  :accept="filetype()"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :on-preview="handlePreview"
                                                  :disabled="isFileDisabled()"
                                                  :data="{seqno:this.seqno, fileCode:'01'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile01"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>文件编码02：未备案申请人身份证明材料（抵押人出具的委托公证书）<font
                                                    color="red"><b>*</b></font>
                                                    
                                                    
                                                    </td>
                                            <td>
                                                                                                <el-upload :action="url" 
                                                  v-if="value1"                                              
                                          
                                                  :on-success="successHandle2"
                                                  ref="upload2"
                                                  :file-list="fileList2"
                                                  multiple
                                                  :before-upload="beforeUpload"
                                                  :accept="filetype()"
                                                  :show-file-list="true"
                                                  :on-preview="handlePreview"
                                                  :disabled="isFileDisabled()"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'02'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile02"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>


                                            </td>
                                        </tr>
                                        <tr>
                                            <td>文件编码03：不动产权证书 <font color="red"><b>*</b></font></td>
                                            <td>
                                                                                                <el-upload :action="url" 
                                          
                                                  :on-success="successHandle3"
                                                  ref="upload3"
                                                  :file-list="fileList3"
                                                  multiple
                                                  :before-upload="beforePicUpload"
                                                  :accept="pictype()"
                                                  :on-preview="handlePreview"
                                                  :disabled="isFileDisabled()"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'03'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile03"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>
                                        

                                        <tr>
                                            <td>文件编码07：主债权合同<font color="red"><b>*</b></font>
                                            </td>
                                            <td>
                                            
                                            <el-upload :action="url" 
                                                  ref="upload7"
                                                  :on-success="successHandle7"
                                                  :disabled="isFileDisabled()"
                                                  :file-list="fileList7"
                                                  multiple
                                                  :before-upload="beforeUpload"
                                                  :accept="filetype()"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                   :on-preview="handlePreview" 
                                                    
                                                  :data="{seqno:this.seqno, fileCode:'07'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile07"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            
                                            </td>
                                        </tr>


                                        <tr>
                                            <td>文件编码04：抵押合同(使用简版合同后不用上送)  </td>
                                            <td>

                                                  <el-upload :action="url" 
                                                  ref="upload4"
                                                  :on-success="successHandle4"
                                                  :file-list="fileList4"
                                                  multiple
                                                  :before-upload="beforeUpload"
                                                  :accept="filetype()"
                                                  :show-file-list="true"
                                                  :on-preview="handlePreview"
                                                   :disabled="isFileDisabled()"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'04'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile04"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>

                                            </td>
                                        </tr>

                                        <tr>
                                            <td>文件编码05：一定期间内将要连续发生的债权的合同或者其他登记原因证明材料
                                            </td>
                                            <td>
                                                  <el-upload :action="url" 
                                                  ref="upload5"
                                                  :on-success="successHandle5"
                                                  :file-list="fileList5"
                                                  multiple
                                                  :on-preview="handlePreview"
                                                  :disabled="isFileDisabled()" 
                                                  :before-upload="beforePicUpload"
                                                  :accept="pictype()"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'05'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile05"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>

                                                                               <tr>
                                            <td>文件编码06：同一房产再次办理抵押知晓函
                                            </td>
                                            <td>
                                                  <el-upload :action="url" 
                                                  ref="upload6"
                                                  :on-success="successHandle6"
                                                  :on-preview="handlePreview"
                                                  :disabled="isFileDisabled()" 
                                                  :file-list="fileList6"
                                                  multiple
                                                  :before-upload="beforePicUpload"
                                                  :accept="pictype()"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'06'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile06"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            </td>
                                        </tr>

                                       <tr>
                                            <td>文件编码08：股东会或董事会决议（股份有限公司、有限责任公司应 提交）；上级主管部门批文（全民所有制企业应提交）；职工（代表）大会决议（集体所有制企业应提交）
                                            </td>
                                            <td>
                                            
                                            <el-upload :action="url" 
                                                  ref="upload8"
                                                  :on-success="successHandle8"
                                                  :disabled="isFileDisabled()"
                                                  :file-list="fileList8"
                                                  :on-preview="handlePreview"
                                                  multiple
                                                  :before-upload="beforePicUpload"
                                                  :accept="pictype()"
                                                  :show-file-list="true"
                                                  :on-exceed="handleExceed"
                                                  :data="{seqno:this.seqno, fileCode:'08'}"
                                                  :before-remove="beforeRemove"
                                                  :on-remove="removeFile08"
                                                  :limit="1"
                                            >
                                              <el-button size="small" type="primary"  v-if="!isFileDisabled()" >点击上传</el-button>
                                            </el-upload>
                                            
                                            </td>
                                        </tr>


                                    </table>                            
  </div>
                                    
  <div><font color="red">影像文件中带 * 的为必须上传的文件</font></div>  
         

</el-col>

    </el-row>

    <el-row>
      <el-col>

  <table width='100%' border="1"  cellspacing="0"  >
                                        <tr>
                                            <td rowspan="10" align="center" width="80px"><b>已备案材料:</b></td>
                                        </tr>
                                        <tr>

                                            <td>营业执照</td>
                             
                             

                                            <td width="50%">
                                                  <div v-if="url1 == ''" class="wba">未备案</div>
                                                   <div class="demo-image__preview" v-if="url1 != ''">
                                                      <el-image 
                                                        style="width: 100px; height: 100px"
                                                        :src="url1" 
                                                        :preview-src-list="srcList">
                                                      </el-image>
                                                  </div>                                           
                                             
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>介绍信
                                                 
                     
                                            
                                            </td>
                                            <td>
                                             <div v-if="url2 == ''" class="wba">未备案</div>
                                              <div class="demo-image__preview" v-if="url2 != ''">
                                                      <el-image 
                                                        style="width: 100px; height: 100px"
                                                        :src="url2" 
                                                        :preview-src-list="srcList">
                                                      </el-image>
                                                  </div> 
                                         

                                            </td>
                                        </tr>
                                        <tr>
                                            <td>身份证</td>
                                            <td>
                                                <div v-if="url3 == ''" class="wba">未备案</div>
                                                 <div class="demo-image__preview" v-if="url3 != ''">
                                                      <el-image 
                                                        style="width: 100px; height: 100px"
                                                        :src="url3" 
                                                        :preview-src-list="srcList">
                                                      </el-image>
                                                  </div>        
                                            </td>
                                        </tr>
                                        

                                        <tr>
                                            <td>签名图片
                                            </td>
                                            <td>
                                            <div v-if="url4 == ''" class="wba">未备案</div>
                                             <div class="demo-image__preview" v-if="url4 != ''">
                                                      <el-image 
                                                        style="width: 100px; height: 100px"
                                                        :src="url4" 
                                                        :preview-src-list="srcList">
                                                      </el-image>
                                                  </div>
                                            
                                            </td>
                                        </tr>


                                        <tr>
                                            <td>合同  </td>
                                            <td>
                                                <div v-if="srcHtbaList.length == 0" class="wba">未备案</div>
                                                <div v-if="srcHtbaList.length > 0">
                                                  <div v-for="(item,index) in srcHtbaList" :key="index" class="table-flex" style="float:left;" >
                                                    <el-image style="width: 100px; height: 100px" :src="item" :preview-src-list="srcList"></el-image>
                                                  </div>
                                                </div>
                                              

                                            </td>
                                        </tr>

                                    </table>                            

      </el-col>
    </el-row>


 <el-row v-if="dataForm.relatedBdcxx.length > 0">
          <el-col :span="24">
    <el-table
      :data="dataForm.relatedBdcxx"
      border
      type="index"
      @selection-change="selectionChangeHandle"
      style="width: 100%;">

        <el-table-column
            prop="realtycertno"
            header-align="center"
            align="center"
            label="不动产权证号">
          <template slot-scope="scope">
                  <el-input v-model="scope.row.realtycertno"
                  :disabled="isInputDisabled()"
                   @keyup.enter.native="queryByRealtycertno(scope.row)"
                   placeholder="填写权证号，[ENTER]自动回显不动产信息"></el-input>
          </template>
        </el-table-column>

        <el-table-column
            prop="realtyunitno"
            header-align="center"
            align="center"
            label="不动产单元号">
          <template slot-scope="scope">
                  <el-input v-model="scope.row.realtyunitno" :disabled="isInputDisabled()" placeholder="不动产单元号"></el-input>
          </template>
        </el-table-column>

                <el-table-column
            prop="zl"
            header-align="center"
            align="center"
            label="不动产坐落">
          <template slot-scope="scope">
                  <el-input v-model="scope.row.zl" :disabled="isInputDisabled()" placeholder="不动产坐落"></el-input>
          </template>
        </el-table-column>

                <el-table-column
            prop="mj"
            header-align="center"
            align="center"
            label="不动产面积">
          <template slot-scope="scope">
                  <el-input v-model="scope.row.mj" :disabled="isInputDisabled()" placeholder="不动产面积"></el-input>
          </template>
        </el-table-column>

      <el-table-column
        fixed="right"
        header-align="center"
        align="center"
        width="150"
        label="操作">
        <template slot-scope="scope">
          <el-button type="text" size="small" :disabled="isInputDisabled()" @click="delBdcxx(scope.row.id)">删除</el-button>
        </template>
      </el-table-column>

        </el-table>


          </el-col>
        </el-row>

  <el-row v-if="dyrList.length > 0">
          <el-col :span="24">

    <el-table
      :data="dyrList"
      border
      type="index"
      
      @selection-change="selectionChangeHandle"
      style="width: 100%;">

        <el-table-column
            prop="MC"
            header-align="center"

            align="center"
            label="抵押人名称">

            <template slot-scope="scope">
                <el-input v-model="scope.row.MC"  :disabled="isInputDisabled()"></el-input>
            </template>

        </el-table-column>

        <el-table-column
            prop="RYLX"
            header-align="center"
            align="center"
            label="抵押人类型">
            <template slot-scope="scope">
                <el-select  v-model="scope.row.RYLX" placeholder="请选择"  :disabled="isInputDisabled()">
                    <el-option
                        v-for="item in dataForm.rylxList"
                        :key="item.value"
                        :label="item.text"
                        :value="item.value">
                    </el-option>
                </el-select>

            </template>
        </el-table-column>

        <el-table-column
            prop="ZJLB"
            header-align="center"
            align="center"
            label="抵押人证件类别">
            <template slot-scope="scope">
                <el-select  v-model="scope.row.ZJLB" placeholder="请选择"  :disabled="isInputDisabled()">
                    <el-option
                        v-for="item in dataForm.idTypeList"
                        :key="item.value"
                        :label="item.text"
                        :value="item.value">
                    </el-option>
                </el-select>

            </template>
        </el-table-column>

        <el-table-column
            prop="ZJHM"
            header-align="center"
            align="center"
            label="抵押人证件号码">
            <template slot-scope="scope">
                <el-input v-model="scope.row.ZJHM"  :disabled="isInputDisabled()"></el-input>
            </template>
        </el-table-column>

      <el-table-column
        fixed="right"
        header-align="center"
        align="center"
        width="150"
        label="操作">
        <template slot-scope="scope">
          <el-button type="text" size="small"  :disabled="isInputDisabled()" @click="delDyr(scope.row.id)">删除</el-button>
        </template>
      </el-table-column>

        </el-table>


          </el-col>
        </el-row>

    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button  type="primary" @click="addBdcxx()" v-if="!isInputDisabled()" >新增不动产</el-button> 
      <el-button  type="primary" @click="addDyr()" v-if="!isInputDisabled()">新增抵押人</el-button> 
        <el-button type="primary" @click="save()" v-if="!isInputDisabled()">信息保存</el-button> 
        <el-button type="primary" @click="saveComplete()" v-if="!isInputDisabled()">录入完成</el-button> 

        <el-button type="primary" @click="uploadComplete()" v-if="isFileEnabled()">资料上传完成</el-button> 
        <el-button type="primary" @click="checkHandle()" 
           v-if="step != 11 && (isAuth('bdc:bdcfirstregist:save') || isAuth('bdc:bdcfirstregist:upload')) ">下载申请书</el-button>  

        <el-button type="primary" @click="submit()"  
          v-if="isSumbitEnabled()">提交</el-button>
        <el-button @click="goback()">返回</el-button>

    </span>
  </el-dialog>
</template>

<script>

  import { isMobile } from '@/utils/validate'

  export default {
    data () {

      var validatePhone = (rule, value, callback) => {
        if (!this.dataForm.id && !isMobile(value)) {
          callback(new Error('抵押权人代理人手机号码有误'))
        } else {
          callback()
        }
      }

      var validateUscc = (rule, value, callback) => {
        if (!this.dataForm.id && !this.datepicker.validlegalbizLicNum(value)) {
          callback(new Error('抵押权人证件号码有误'))
        } else {
          callback()
        }
      }

      var validateIdCard = (rule, value, callback) => {
        if (!this.dataForm.id && !this.datepicker.checkIdNumberValid(value)) {
          callback(new Error('抵押人代理人证件号码有误'))
        } else {
          callback()
        }
      }

      var validateCheckresult = (rule, value, callback) => {
        if (!value && this.dataForm.state == '52') {
          callback(new Error('审核结果不能为空'))
        } else {
          callback()
        }
      }

      var validateRejectreason = (rule, value, callback) => {
        if (!value && this.dataForm.state == '52' && this.dataForm.checkresult != '1') {
          callback(new Error('审核不通过理由不能为空'))
        } else {
          callback()
        }
      }

      return {
  
        allnet: false,
        tip:'',
        check: true,
        options: [],
        otherImages:[],
        oImages: [],
        htbaItems: [],
        loading: false,
        visible: false,
        url: '',
        title: '',
     
        list: '',

        srcList: [],
        url1: '',
        url2: '',
        url3: '',
        url4: '',
        srcHtbaList: [],

        fileList1: [],
        fileList2: [],
        fileList3: [],
        fileList4: [],
        fileList5: [],
        fileList6: [],
        fileList7: [],
        fileList8: [],
        fileList30: [],
        dataListLoading: false,
        submitLoading: false,
        dyrList: [],
        seqno: 0,
        step: 0,
        seRegion: '',
        region: '',
        application: 0,
        value1: true,

        dataForm: {
          seRegionList: [],
          regionList: [],
          dyqrlxdh: '',
          seqno: 0,
          dyqrmc: '',
          dyqrlx: '',
          dyqrzjlx: '统一社会信用代码',
          dyqrzjhm: '',
          dyrdlrmc: '',
          region: '',
          seRegion: '',

          dyrdlrlx: '',
          dyrdlrzjlx: '',

          dyrdlrzjhm: '',
          dlrdh: '',
          gllx: '',

          babsm: '',
          dbje: '',

          zwr: '',
          rightagenttype: '个人',
          rightagentidtype: '身份证',
 
          zwbegintime: '',
          zwendtime: '',
          site: '',
          yzbfs: '',
          gettype: '',
          dyghbs: '',
          dbfw: '',

          left1: '',
          left2: '',
          left3: '',
          left4: '',    
          right1: '',
          right2: '',
          right3: '',
          right4: '',
          dyghList: [],
          idTypeList: [],
          rylxList: [],
          yzbTypeList: [],
          bdcxxList: [],
          relatedBdcxx:[],
          contractTypeList: [],
          contractno: '',
          ctype: '',
          isdzyxyw: '0',
          dyfs: '0',
          btype: '7',
  
          ywlx: '',
          fj: '',
          checkresult: '',
          rejectreason: '',
          state: '',
          siteList: []
        },
        dataRule: {

          checkresult:[
              { validator: validateCheckresult, trigger: 'blur' }
          ],

          rejectreason:[
              { validator: validateRejectreason, trigger: 'blur' }
          ],
         

          dyfs:[
            { required: true, message: '抵押方式不能为空', trigger: 'blur' }
          ],
          dyrdlrmc:[
            { required: true, message: '抵押人代理人名称不能为空', trigger: 'blur' }
          ],
          dyrdlrzjhm:[
            { required: true, message: '抵押人代理人证件号码不能为空', trigger: 'blur' },
             { validator: validateIdCard, trigger: 'blur' }
          ],

          dyqrmc:[
            { required: true, message: '抵押权人名称不能为空', trigger: 'blur' }
          ],
          dyqrzjhm:[
            { required: true, message: '抵押权人证件号码不能为空', trigger: 'blur' },
             { validator: validateUscc, trigger: 'blur' }
          ],
          dbje:[
            { required: true, message: '主债权担保金额不能为空', trigger: 'blur' }
          ],
          zwbegintime:[
            { required: true, message: '债务履行开始日期不能为空', trigger: 'blur' }
          ],
          zwr:[
            { required: true, message: '债务人不能为空', trigger: 'blur' }
          ],
          zwendtime:[
            { required: true, message: '务履行结束日期不能为空', trigger: 'blur' }
          ],
          site: [
            { required: true, message: '办理点不能为空', trigger: 'blur' }
          ],
          yzbfs: [
            { required: true, message: '预转本方式不能为空', trigger: 'blur' }
          ],
          dyghbs: [
            { required: true, message: '带抵押过户标识不能为空', trigger: 'blur' }
          ],
          seRegion: [
            { required: true, message: '不动产所属地市不能为空', trigger: 'blur' }
          ],
          region: [
            { required: true, message: '不动产所属区县不能为空', trigger: 'blur' }
          ],
          fj: [
            { required: true, message: '附记不能为空', trigger: 'blur' }
          ],
          dlrdh: [
            { required: true, message: '抵押权人代理人电话不能为空', trigger: 'blur' },
             { validator: validatePhone, trigger: 'blur' }
          ]
        }
      }
    },
    methods: {
      pictype(){
        return "image/jpg,image/jpeg"
      },
      filetype(){
        if (this.dataForm.isdzyxyw == 0){
            return "image/jpg,image/jpeg"
        }
        else{
          return ".pdf,.PDF"
        }
      },


      selectChanged2(value){
          this.dataForm.site = ''
          var self = this
          this.$http({
          url: this.$http.adornUrl(`/bdc/bdcsiteinfo/query/` + value),
              method: 'get',
              params: this.$http.adornParams()
          }).then(({data}) => {
            if (data && data.code === 0) {
              self.dataForm.siteList = data.siteList
            }else{
              self.dataForm.siteList = []
            }
        })
      },

      init (id, step, btype, application) {
        this.remoteMethod2()
        this.dataForm.relatedBdcxx = []
        this.dyrList = []  
        this.oImages = []
        this.url3 = ''
        this.url2 = '',
        this.url1 = '',
        this.url4 = '',
        this.srcList = []
        this.srcHtbaList = [] 
 
        this.dataForm.checkresult = ""
        this.dataForm.rejectreason = ""
      
        this.application = application
             

        if (step == 0 || step == 10){
           this.dataForm.seqno = id
           this.seqno = 0
        }else if (step > 0){
          this.seqno = id
        }

        this.dataForm.state = ''

        this.fileList1 = [];
        this.fileList2 = [];
        this.fileList3 = [];
        this.fileList4 = [];
        this.fileList5 = [];
        this.fileList7 = [];
        this.fileList6 = [];
        this.fileList8 = [];
        this.fileList30 = [];
  
        this.visible = true
        this.url = this.$http.adornUrl(`/bdc/bdcfirstregist/upload?token=${this.$cookie.get('token')}`)
        this.dataForm.gettype = '电子证明';
        this.step = step;
        this.title = '首次登记';
        if (application == 0){
            this.title = '公证委托' + this.title;
        }else{
            this.title = '全程网办' + this.title;
            this.allnet = true;
        } 

        

        if (step == 1){
           this.title = this.title + '(完善登记)';
           
        }else if (step == 2){
           this.title = this.title + '(重新提交)';
        }
        else if (step == 11){
           this.title = this.title + '(影像材料补正)';
        }else if (step == 51){  
            this.title = this.title +  "(资料上传)"                
        }else if (step == 52){  
            this.title = this.title +  "(审核提交)"                
        }
        

        
        this.$http({
          url: this.$http.adornUrl(`/bdc/bdcfirstregist/item/list`),
              method: 'get',
              params: this.$http.adornParams()
          }).then(({data}) => {
            if (data && data.code === 0) {
            
                this.dataForm.yzbTypeList = data.yzbTypeList
                this.dataForm.dyghList = data.dyghList
                this.dataForm.rylxList = data.rylxList
                this.dataForm.idTypeList = data.idTypeList
                this.dataForm.contractTypeList = data.contractTypeList

 
            }

            if (btype){
                this.btype = btype
                if(btype == '7' || btype == '6'){
                    this.dataForm.dyfs = '0'
                }else if(btype == '9' || btype == '8'){
                    this.dataForm.dyfs = '1'
                }
            }
            this.dataForm.left1 = ''
            this.dataForm.left2 = ''
            this.dataForm.right1 = ''
            this.dataForm.right2 = ''
            this.dataForm.right3 = ''
            this.dataForm.right4 = ''
        })

        this.$nextTick(() => {
          this.$refs['dataForm'].resetFields()

          this.$http({
            url: this.$http.adornUrl(`/bdc/bdcfirstregist/sitem/list`),
                method: 'get',
                params: this.$http.adornParams()
            }).then(({data}) => {
              if (data && data.code === 0) {
                  this.dataForm.seRegionList = data.regionList
                  this.dataForm.dyqrmc = data.dyqrmc
                  this.dataForm.dyqrlxdh = data.dyqrlxdh
                  this.dataForm.dyqrlx = '单位';
                  this.dataForm.dyqrzjlx = '统一社会信用代码';
                  this.dataForm.dyqrzjhm = data.uscc
  
              }
          })
          this.dataForm.dyrdlrlx = '个人'
          this.dataForm.dyrdlrzjlx = '身份证'
          this.dataForm.dbfw = '详见合同'
            
          
            if (step == 0){
                this.$http({
                url: this.$http.adornUrl(`/bdc/bdcfirstregist/query/contract/${this.dataForm.seqno}`),
                method: 'get',
                params: this.$http.adornParams()
              }).then(({data}) => {
                if (data && data.code === 0) {

                  this.dataForm.seRegion = data.seRegion
                  this.dataForm.region = data.bdcContract.region
                  if (data.bdcxxList){
                    this.dataForm.relatedBdcxx = data.bdcxxList  
                  }
                  if (data.dyrList){
                    this.dyrList = data.dyrList
                  }                 

                }
                this.dataListLoading = false;
              })
            }
            else if (step == 10){
                this.$http({
                url: this.$http.adornUrl(`/bdc/bdcfirstregist/query/realtyunit/${this.dataForm.seqno}`),
                method: 'get',
                params: this.$http.adornParams()
              }).then(({data}) => {
                if (data && data.code === 0) {
                  this.dataForm.seRegion = data.seRegion
                  this.dataForm.region = data.region
                  if (data.bdcxxList){
                    this.dataForm.relatedBdcxx = data.bdcxxList  
                  }
                  if (data.dyrList){
                    this.dyrList = data.dyrList
                  }                 

                }
                this.dataListLoading = false;
              })

            }
            else if (step == 1 || step == 11 || step == 2 || step == 51 || step == 52){
                    this.submitLoading = true;
                    this.tip = "加载中"  
                  this.$http({
                  url: this.$http.adornUrl(`/bdc/bdcfirstregist/info/${this.seqno}`),
                  method: 'get',
                  params: this.$http.adornParams()
                }).then(({data}) => {
                  if (data && data.code === 0) {
                  if (data.bdcxxList){
                    this.dataForm.relatedBdcxx = data.bdcxxList  
                  }
                  
                  this.dyrList = data.dyrList
                  if (data.bdcxxList){
                      this.dataForm.bdcxxList = data.bdcxxList
                  }
           
                  this.dataForm.seRegion = data.bdcMortgregist.seRegion

                  if (this.step == 11 || this.step == 51){
                    this.$http({
                    url: this.$http.adornUrl(`/bdc/bdcrecordimage/babsm/list`),
                        method: 'get',
                        params: this.$http.adornParams({
                          'seRegion': data.bdcMortgregist.seRegion
                        })
                    }).then(({data}) => {
                      if (data && data.code === 0) {
                          this.otherImages = data.list
          
                      }

                  })
                  }

                  this.dataForm.region = data.bdcMortgregist.region
                  this.seRegion = data.bdcMortgregist.seRegion
                  this.region = data.bdcMortgregist.region

                  this.dataForm.dyqrmc = data.dyqrmc
                  this.dataForm.dyqrlxdh = data.dyqrlxdh
                  this.dataForm.dyqrlx = '单位';
                  this.dataForm.dyqrzjlx = '统一社会信用代码';
                  this.dataForm.dyqrzjhm = data.uscc

                  this.dataForm.dyrdlrmc = data.dyrdlr.MC
                  if (data.dyrdlr.RYLX){
                    this.dataForm.dyrdlrlx = data.dyrdlr.RYLX
                  }
                  else{
                     this.dataForm.dyrdlrlx = '个人'
                  }
                  if (data.dyrdlr.ZJLB){
                     this.dataForm.dyrdlrzjlx = data.dyrdlr.ZJLB
                  }else{
                     this.dataForm.dyrdlrzjlx = '身份证'
                  }
                 
                  this.dataForm.dyrdlrzjhm = data.dyrdlr.ZJHM
                  this.dataForm.dlrdh = data.dyrdlr.LXDH

                  this.dataForm.gllx = '预抵和预告合并办理'
                  this.dataForm.babsm = data.bdcMortgregist.babsm
                  this.dataForm.site = data.bdcMortgregist.bld
                

                  this.dataForm.zwr = data.zwr

                  this.dataForm.left1 = data.dyqrXwbl.SFYYZS
                  this.dataForm.left2 = data.dyqrXwbl.SFGY
                  this.dataForm.right1 = data.dyrXwbl.SFYYZS
                  this.dataForm.right2 = data.dyrXwbl.SFGY
                  this.dataForm.right3 = data.dyrXwbl.SFZJYS
                  this.dataForm.right4 = data.dyrXwbl.SFZJYZ
                  // this.dataForm.contractno = data.htba.HTBAH
                  // this.dataForm.ctype = data.htba.HTLX

                  this.dataForm.dbje = data.bdcMortgregist.bdbzqse
          
                  this.dataForm.zwbegintime = data.bdcMortgregist.zwlxqssj
                  this.dataForm.zwendtime = data.bdcMortgregist.zwlxjssj
                  this.dataForm.yzbfs = data.bdcMortgregist.iszzyzb
                  this.dataForm.dyghbs = data.bdcMortgregist.isdygh
                  this.dataForm.dbfw = data.bdcMortgregist.dbfw
                  this.dataForm.fj = data.bdcMortgregist.fj

                  this.dataForm.isdzyxyw = data.bdcMortgregist.isdzyxyw

                  this.dataForm.state = data.bdcMortgregist.state
                  // if (data.yxbsmList){
                  //     this.oImages = data.yxbsmList
                  //     this.value1 = false
                  // }else{                   
                  // }
                  this.value1 = true
                  this.oImages = []

                    if (data.file01){
                      var self = this
                      data.file01.forEach(function(item){
                        self.fileList1.push({'name':item, 'url': self.seqno + '_01_' + item})
                      })
                      
                    }
                    if (data.file02){
                      var self = this
                      data.file02.forEach(function(item){
                        self.fileList2.push({'name':item, 'url': self.seqno + '_02_' + item})
                      })
  
                    }
                    if (data.file03){
                      var self = this
                      data.file03.forEach(function(item){
                        self.fileList3.push({'name':item, 'url': self.seqno + '_03_' + item})
                      })
                 
                    }
                    if (data.file04){
                      var self = this
                      data.file04.forEach(function(item){
                        self.fileList4.push({'name':item, 'url': self.seqno + '_04_' + item})
                      })
                      
                    }
                    if (data.file05){
                      var self = this
                      data.file05.forEach(function(item){
                        self.fileList5.push({'name':item, 'url': self.seqno + '_05_' + item})
                      })
                    }
                    if (data.file07){
                      var self = this
                      data.file07.forEach(function(item){
                        self.fileList7.push({'name':item, 'url': self.seqno + '_07_' + item})
                      })
     
                    }
                    if (data.file06){
                       var self = this
                       data.file06.forEach(function(item){
                         self.fileList6.push({'name':item, 'url': self.seqno + '_06_' + item})
                       })
                    }
                    if (data.file08){
                      var self = this
                       data.file08.forEach(function(item){
                         self.fileList8.push({'name':item, 'url': self.seqno + '_08_' + item})
                       })
                    }    
                    if (data.file30){
                      var self = this
                       data.file30.forEach(function(item){
                         self.fileList30.push({'name':item, 'url': self.seqno + '_30_' + item})
                       })
                    }           

                  }
                  this.initBabsm()
                  this.submitLoading = false
                }).catch(err => {
                 this.submitLoading = false;
                 console.error(err);            
              }); 
            }
            
          
        })
      },


      handlePreview(file){
          if (!file.url){
            return
          }
          console.log(file.url)
          var token = this.$cookie.get('token')
      　　var url = this.$http.adornUrl('/bdc/bdcfirstregist/downFile/' + file.url + '?token=' + token)
          window.open(url)
      },

      checkDyqrPhone(successCallback){
          this.$http({
                url: this.$http.adornUrl(`/bdc/bdcrecordimage/phone/check`),
                method: 'post',
                data: this.$http.adornData({
                  'region': this.dataForm.region,
                  'seRegion': this.dataForm.seRegion,
                  'phone': this.dataForm.dlrdh,
                  'dyqr': this.dataForm.dyqrmc,
                  'name': this.dataForm.dyrdlrmc,
                  'idcode': this.dataForm.dyrdlrzjhm
                })
            }).then(({data}) => {
                if (data && data.code === 0) {
                    if (successCallback){
                      successCallback()
                    }
                }else{
                  this.$message.error(data.msg)
                }

            })
      },

      initBabsm(){
            this.$http({
                url: this.$http.adornUrl(`/bdc/bdcrecordimage/query/jbr`),
                method: 'post',
                data: this.$http.adornData({
                  'region': this.dataForm.region,
                  'seRegion': this.dataForm.seRegion,
                  'phone': this.dataForm.dlrdh,
                  'dyqr': this.dataForm.dyqrmc
                })
            }).then(({data}) => {
                if (data && data.code === 0) {
                    this.oImages.push(data.dyqrdlr.yxbsm)
                    this.dataForm.dyrdlrmc = data.dyqrdlr.name
                    this.dataForm.dyrdlrzjhm = data.dyqrdlr.idcode

                    this.url2 = this.buildDownloadUrl(data.dyqrdlr.yxbsm + "_" + data.dyqrdlr.fname)
                    console.log(this.url2)
                    // this.url1 = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13917715128%2F641&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1632565134&t=65ae7ed18c96a6433a0da054c039d9c4';
                    this.queryYyzz(data.dyqrdlr.bdcno)
                    this.querySfz(data.dyqrdlr.bdcno, data.dyqrdlr.name+data.dyqrdlr.idcode)
                    this.querySignpic(data.dyqrdlr.bdcno, data.dyqrdlr.name+data.dyqrdlr.idcode)
                    this.queryHtbaList(data.dyqrdlr.bdcno)
                }else{
                  this.$message.error(data.msg)
                  this.url2 = ''
                }

            })
      },

      queryYyzz(djzx){
        this.$http({
                url: this.$http.adornUrl(`/bdc/bdcrecordimage/query/yyzz`),
                method: 'post',
                data: this.$http.adornData({
                  'bdcno': djzx,
                  'dyqr': this.dataForm.dyqrmc
                })
            }).then(({data}) => {
                if (data && data.code === 0) {
                    this.url1 = this.buildDownloadUrl(data.yyzz.yxbsm + "_" + data.yyzz.fname)
                    console.log(this.url1)
                    this.oImages.push(data.yyzz.yxbsm)
                }

            })
      },

      querySignpic(djzx, fname){
        this.$http({
                url: this.$http.adornUrl(`/bdc/bdcrecordimage/query/signpic`),
                method: 'post',
                data: this.$http.adornData({
                  'bdcno': djzx,
                  'fname': '手写签名-'+fname,
                  'dyqr': this.dataForm.dyqrmc
                })
            }).then(({data}) => {
                if (data && data.code === 0) {
                    this.url4 = this.buildDownloadUrl(data.signpic.yxbsm + "_" + data.signpic.fname)
                    console.log(this.url4)
                    this.oImages.push(data.signpic.yxbsm)
                }

            })
      },

      queryHtbaList(djzx){
        this.$http({
                url: this.$http.adornUrl(`/bdc/bdcrecordimage/query/htba`),
                method: 'post',
                data: this.$http.adornData({
                  'bdcno': djzx
                })
            }).then(({data}) => {
                if (data && data.code === 0) {
                  this.oImages.push(data.yxbsm)
                  for (var i = 0; i < data.htbaList.length; i++){
                    var htba = data.htbaList[i]
                    var url = this.buildDownloadUrl(htba)
                    this.srcHtbaList.push(url)
                    console.log(url)
                  }
                    
                }

            })
      },

      querySfz(djzx, fname){
        this.$http({
                url: this.$http.adornUrl(`/bdc/bdcrecordimage/query/sfz`),
                method: 'post',
                data: this.$http.adornData({
                  'bdcno': djzx,
                  'fname': '身份证-'+fname,
                  'dyqr': this.dataForm.dyqrmc
                })
            }).then(({data}) => {
                if (data && data.code === 0) {
                    this.url3 = this.buildDownloadUrl(data.sfz.yxbsm + "_" + data.sfz.fname)
                    console.log(this.url3)
                    this.oImages.push(data.sfz.yxbsm)
                }

            })
      },

      queryDyqr(){

        if (!this.dataForm.seRegion){
          this.$message.error("请选择所属地市")
          return
        }

        if (!this.dataForm.region){
          this.$message.error("请选择所属区县")
          return
        }

        if (!this.dataForm.dyqrmc){
          this.$message.error("请选择抵押权人")
          return
        }

        this.initBabsm()

      },

      buildDownloadUrl(name){
            var token = this.$cookie.get('token')
        　　var url = this.$http.adornUrl('/bdc/bdcrecordimage/downFile/' + name  + ".jpg" + '?token=' + token)
            this.srcList.push(url)
            return url;
      },

      queryByRealtycertno(row){
          var certno = row.realtycertno
            this.$http({
                url: this.$http.adornUrl(`/bdc/bdcfirstregist/queryRealty/${certno}`),
                method: 'get',
                params: this.$http.adornParams()
            }).then(({data}) => {
                if (data && data.code === 0) {
                    row.realtyunitno = data.realty.realtyunitno
                    row.zl = data.realty.location
                    row.mj = data.realty.buildingarea

                    var dyrList = data.dyrList
                    if (dyrList){
                      var length = this.dyrList.length;
                      for (var i in dyrList)
                      {
                        var dyr = dyrList[i]
                        var exist = false
                        for (var j = 0; j < length; j++){
                          if (dyr.rymc == this.dyrList[j].MC){
                              exist=true
                              break
                          }
                        }
                        if (!exist){
                            this.dyrList.push({
                              "id": length,
                              "MC": dyr.MC,
                              "RYLX": dyr.RYLX,
                              "ZJLB": dyr.ZJLB,
                              "ZJHM": dyr.ZJHM
                            })
                            length++
                        }
                        
                      }
                    }
                }

            })
      },

      isInputDisabled(){
          return this.step == 11  || !this.isAuth('bdc:bdcfirstregist:save') 
          || this.dataForm.state != '' && this.dataForm.state != '00' && this.dataForm.state != '11'
           && this.dataForm.state != '53'
      },

      isFileDisabled(){
          return !this.isFileEnabled()
      },

      isFileEnabled(){
          return this.isAuth('bdc:bdcfirstregist:upload')  &&  (this.dataForm.state == '41'
           || this.dataForm.state == '54' || this.dataForm.state == '51')
      },

      isSumbitEnabled(){

          return (this.dataForm.state=='52' || this.dataForm.state=='41')   && this.isAuth('bdc:bdcfirstregist:commit') 

      },

      switchChangeHandle(val){
        console.log(val)
      },

      // 多选
      selectionChangeHandle (val) {
        this.dataListSelections = val
      },
      selectChanged(value){
          this.dataForm.region = '';
          this.$http({
          url: this.$http.adornUrl(`/sys/bdcregion/listByLevle`),
              method: 'get',
              params: this.$http.adornParams({'upregion':value})
          }).then(({data}) => {
            if (data && data.code === 0) {
              this.dataForm.regionList = data.list
            }
        })
      },



      searchHtbh(query){
        if (query !== '') {
          this.loading = true;
          
          this.$http({
              url: this.$http.adornUrl(`/bdc/bdccontract/search/${query}`),
              method: 'get',
              params: this.$http.adornParams()
            }).then(({data}) => {
                if (data && data.code === 0) {
                  this.htbaItems = data.list
                }else {
                  this.htbaItems = [];
                }
                this.loading = false;
          })

        } else {
          this.htbaItems = [];
        }
      },

      remoteMethod2(query) {
   
          this.loading = true;

          this.$http({
            url: this.$http.adornUrl(`/sys/user/branch/search`),
            method: 'get',
            params: this.$http.adornParams({
              "key": query || ''
            })
          }).then(({data}) => {
            this.loading = false;
            if (data && data.code === 0) {
                this.list = data.list;
            }
          })     
          

      },

      remoteMethod(query){
        if (query !== '') {
          this.loading = true;
          
          this.$http({
              url: this.$http.adornUrl(`/sys/bdcregion/search/${query}`),
              method: 'get',
              params: this.$http.adornParams()
            }).then(({data}) => {
                if (data && data.code === 0) {
                  this.options = data.list
                }else {
                  this.options = [];
                }
                this.loading = false;
          })

        } else {
          this.options = [];
        }
      },
            // 上传成功
      successHandle (response, file, callback, successCallback) {

        if (response && response.code === 0) {
            this.$message({
              message: '上传文件成功',
              type: 'success',
              duration: 1500
            });
            if (!this.seqno){
              this.seqno = response.seqno
            }
            if (successCallback){
              successCallback(file)
            }

        } else {
          this.$message.error(response.msg)
            if (callback){
              callback();
            }
        }
      },
      // 上传成功
      successHandle1 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
             self.$refs.upload1.clearFiles()
        }, function(file){
          file.url = self.seqno + '_01_' + file.name;
          console.log(file)
        })
        
      },
      successHandle2 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
            self.$refs.upload2.clearFiles()
        }, function(file){
          file.url = self.seqno + '_02_' + file.name;
          console.log(file)
        })
        
      },
      successHandle3 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
            self.$refs.upload3.clearFiles()
        }, function(file){
          file.url = self.seqno + '_03_' + file.name;
          console.log(file)
        })       
      },
      successHandle30 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
            self.$refs.upload30.clearFiles()
        }, function(file){
          file.url = self.seqno + '_30_' + file.name;
          console.log(file)
        })    
      },
      successHandle4 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
            self.$refs.upload4.clearFiles()          
        }, function(file){
          file.url = self.seqno + '_04_' + file.name;
          console.log(file)
        })
        
      },
    successHandle5 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
            self.$refs.upload5.clearFiles()          
        }, function(file){
          file.url = self.seqno + '_05_' + file.name;
          console.log(file)
        })       
      },
      successHandle6 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
            self.$refs.upload6.clearFiles()   
        }, function(file){
          file.url = self.seqno + '_06_' + file.name;
          console.log(file)
        })
        
      },
      successHandle7 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
            self.$refs.upload7.clearFiles()    
        }, function(file){
          file.url = self.seqno + '_07_' + file.name;
          console.log(file)
        })
        
      },
      successHandle8 (response, file) {
        var self = this;
        this.successHandle(response, file, function(){
            self.$refs.upload8.clearFiles()    
        }, function(file){
          file.url = self.seqno + '_08_' + file.name;
          console.log(file)
        })
        
      },

      beforePicUpload (file) {
        
          if (file.type !== 'image/jpg' && file.type !== 'image/jpeg') {
            this.$message.error('只支持jpg格式的图片！')
              this.check = false
            return false
          }
        
           this.check = true 
      },

      beforeUpload (file) {
        if (this.dataForm.isdzyxyw == 0){
          if (file.type !== 'image/jpg' && file.type !== 'image/jpeg') {
            this.$message.error('只支持jpg格式的图片！')
              this.check = false
            return false
          }
        }else{
          if (file.type !== 'application/pdf' && file.type !== 'application/PDF') {
            this.$message.error('请上传pdf文件')
              this.check = false
            return false
          }
        }
           this.check = true 
      },

      // 上传之前
      beforeUploadHandle (file) {
          if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') {
            this.$message.error('只支持jpg、png、gif格式的图片！')
            return false
          }
      },

      handleExceed(files, fileList) {
        this.$message.warning('只能上传一个文件');
      },
      beforeRemove(file, fileList) {
        if (this.check){
            return this.$confirm(`确定移除 ${ file.name }？`);
        }
        
      },
      beforeRemove30(file, fileList) {
         if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') {
           this.$refs.upload30.clearFiles()   
           return false;
         }
        return this.$confirm(`确定移除 ${ file.name }？`);
      },

      removeFile30(file, fileList) {
        this.removeFile(file, fileList, '30',function(){
          this.fileList30 = fileList
        })
      },

      removeFile08(file, fileList) {
        this.removeFile(file, fileList, '08',function(){
          this.fileList8 = fileList
        })
      },

      removeFile07(file, fileList) {
        this.removeFile(file, fileList, '07',function(){
          this.fileList7 = fileList
        })
      },

      removeFile06(file, fileList) {
        this.removeFile(file, fileList, '06',function(){
          this.fileList6 = fileList
        })
      },

      removeFile05(file, fileList) {
        this.removeFile(file, fileList, '05',function(){
          this.fileList5 = fileList
        })
      },

      removeFile04(file, fileList) {
        this.removeFile(file, fileList, '04',function(){
          this.fileList4 = fileList
        })
      },

      removeFile03(file, fileList) {
        this.removeFile(file, fileList, '03',function(){
          this.fileList3 = fileList
        })
      },

      removeFile02(file, fileList) {
        this.removeFile(file, fileList, '02',function(){
          this.fileList2 = fileList
        })
      },

      removeFile01(file, fileList) {
        this.removeFile(file, fileList, '01',function(){
          this.fileList1 = fileList
        })
      },

      removeFile(file, fileList, filecode, callback){
          this.$http({
          url: this.$http.adornUrl(`/bdc/bdcfirstregist/remove`),
              method: 'post',
              data: this.$http.adornData({
                'seqno': this.seqno,
                'fileCode': filecode,
                'fileName': file.name
              })
          }).then(({data}) => {
            if (data && data.code === 0) {
              if (this.check){
               this.$message({
                  message: '删除成功',
                  type: 'success',
                  duration: 1500
                })
              }
               
            }else{
              this.$message.error(data.msg)
              if (callback){
                  callback();
               }
            }
        })
      },

     addDyr(){
        var length = this.dyrList.length;
        this.dyrList.push({
          "id": length,
          "MC": "",
          "RYLX": "1",
          "ZJLB": "1",
          "ZJHM": ""
        })
     },

    delDyr(id){
      for (var i in this.dyrList){
        if (this.dyrList[i].id == id){
          this.dyrList.splice(i, 1)
        }
      }
    },

     addBdcxx(){
       var length = this.dataForm.relatedBdcxx.length;
       this.dataForm.relatedBdcxx.push({
         "id": length,
         "realtycertno": "",
         "realtyunitno": "",
         "zl": "",
         "mj": ""
       })
     },

    delBdcxx(id){
      for (var i in this.dataForm.relatedBdcxx){
        if (this.dataForm.relatedBdcxx[i].id == id){
          this.dataForm.relatedBdcxx.splice(i, 1)
        }
      }
    },


    checkHandle(){
        this.$http({
            url: this.$http.adornUrl(`/bdc/bdcfirstregist/check/${this.seqno}`),
            method: 'get',
            params: this.$http.adornParams()
          }).then(({data}) => {
            if (data && data.code === 0) {
              this.downloadFileClick()
            }else{
              this.$message.error(data.msg)
            }
          })
      },

      downloadFileClick() {
          var token = this.$cookie.get('token')
      　　var url = this.$http.adornUrl(`/bdc/bdcfirstregist/downApply/${this.seqno}?token=` + token)
          // window.open(url)
          window.location.href = url
      },

      submitYxclbz(){
          if (!this.checkQwbFiles()){
            return;
          }
        this.tip = "正在提交"
        this.submitLoading = true;
        this.$http({
              url: this.$http.adornUrl(`/bdc/bdcfirstregist/send/image/${this.seqno}`),
              method: 'get',
              params: this.$http.adornParams()
            }).then(({data}) => {
              if (data && data.code === 0) {
                  this.$message({
                    message: '影像材料补正成功',
                    type: 'success',
                    duration: 1500,
                    onClose: () => {
                      this.visible = false
                      this.$emit('refreshDataList')
                    }
                  })
              }else {
                  this.$message.error(data.msg)
              }
              this.submitLoading = false;
            }).catch(err => {
              this.submitLoading = false;
              console.error(err);
              this.$message.error('系统异常')              
            });
      },

      goback(){
          this.visible = false
          this.$emit('refreshDataList')
      },

      doSubmit(){

        this.tip = "正在提交"
        this.submitLoading = true;
        this.$http({
              url: this.$http.adornUrl('/bdc/bdcfirstregist/send'),
              method: 'post',
              data: this.$http.adornData({
                'seqno': this.seqno,
                'rejectreason': this.dataForm.rejectreason,
                'checkresult':this.dataForm.checkresult,
                 'yxbsms': this.oImages,
                'seRegion': this.dataForm.seRegion,
                'region': this.dataForm.region,
                'btype': this.btype
              })
            }).then(({data}) => {
              if (data && data.code === 0) {

                this.$message({
                  message: '提交成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {

                      this.visible = false
                      this.$emit('refreshDataList')
                    
                  }
                })
              } else {
                this.$message.error(data.msg)
              }
              this.submitLoading = false;
            }) .catch(err => {
              this.submitLoading = false;
              console.error(err);
              this.$message.error('系统异常')              
            }); 

      },

      submit(){
        if (this.step == 11){
          this.submitYxclbz();
        }else{

            this.$refs['dataForm'].validate((valid) => {
            if (valid) {
              

                  if ('1' == this.dataForm.checkresult){
                      this.$confirm('此操作将提交给登记中心, 是否继续?', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning',
                        center: true
                      }).then(() => {
                        this.doSubmit()
                      }).catch(() => {
                        
                      });
                  }
                  else{
                    this.doSubmit()
                  }

            }
            else{
              this.$message.error("参数校验失败")
          
            }
          })


         

        
        }        
      },

      uploadComplete(){

        if (this.btype == '6' || this.btype == '8'){
            if (!this.checkQwbFiles()){
              return;
            }
        }
        else if (this.btype == '7'){
            if (this.$refs.upload1.uploadFiles.length == 0){
                this.$message.error("请上传文件编码01")
                return;
            }

            if (this.value1 && this.$refs.upload3.uploadFiles.length == 0 || !this.value1 && this.oImages.length == 0){
                this.$message.error("请上传文件编码03")
                return;
            }



            if (this.$refs.upload4.uploadFiles.length == 0){
                this.$message.error("请上传文件编码04")
                return;
            }
            if (this.$refs.upload7.uploadFiles.length == 0){
                this.$message.error("请上传文件编码07")
                return;
            }
        }else if (this.btype == '9'){
            if (this.$refs.upload1.uploadFiles.length == 0){
                this.$message.error("请上传文件编码01")
                return;
            }

            if (this.value1 && this.$refs.upload2.uploadFiles.length == 0 
              || !this.value1 && this.oImages.length == 0){
                this.$message.error("请上传文件编码02")
                return;
            }

            if (this.$refs.upload3.uploadFiles.length == 0){
                this.$message.error("请上传文件编码03")
                return;
            }
            if (this.$refs.upload7.uploadFiles.length == 0){
                this.$message.error("请上传文件编码07")
                return;
            }
        }

        this.tip = "正在保存资料"

        this.submitLoading = true;
        this.$http({
              url: this.$http.adornUrl('/bdc/bdcfirstregist/uploadComplete'),
              method: 'post',
              data: this.$http.adornData({
                'seqno': this.seqno,
                'btype': this.btype,
                // 'yxbsms': this.oImages,
                'ftype': this.ftype,
                'yxflag': this.value1
              })
            }).then(({data}) => {
              if (data && data.code === 0) {

                this.$message({
                  message: '首次登记信息资料上传完成',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {

                      this.visible = false
                      this.$emit('refreshDataList')
                    
                  }
                })
              } else {
                this.$message.error(data.msg)
              }
              this.submitLoading = false;
            }) .catch(err => {
              this.submitLoading = false;
              console.error(err);
              this.$message.error('系统异常')              
            }); 

      },

      saveComplete(){

          this.save(true);
              
      },

      generateBtype(){
        if (this.application == 0){
            this.dataForm.dyfs == '0' ? this.btype = '7' : this.btype = '9'           
        }else{
            this.dataForm.dyfs == '0' ? this.btype = '6' : this.btype = '8'   
        }
      },

      commit(path){

        var djry = [{
                  'TYPE': '09',
                  'RYLX': '1',
                  'ZJLB': '1',
                  'MC': this.dataForm.dyrdlrmc,
                  'ZJHM': this.dataForm.dyrdlrzjhm,
                  'LXDH': this.dataForm.dlrdh
              },
              {
                  'TYPE': '08',
                  'RYLX': '1',
                  'ZJLB': '1',
                  'MC': this.dataForm.dyrdlrmc,
                  'ZJHM': this.dataForm.dyrdlrzjhm,
                  'LXDH': this.dataForm.dlrdh
              },
              {
                  'TYPE': '03',
                  'RYLX': '2',
                  'ZJLB': '13',
                  'MC': this.dataForm.dyqrmc,
                  'ZJHM': this.dataForm.dyqrzjhm,
                  'LXDH': this.dataForm.dyqrlxdh
              }
              
              ];

        if (this.dataForm.zwr){
            var zwrs = this.dataForm.zwr.split("/")
            for (var i = 0; i < zwrs.length; i++){
                var zwr = zwrs[i];
                if (zwr){
                    djry.push({
                    'TYPE': '05',
                    'RYLX': '1',
                    'ZJLB': '',
                    'MC': zwr,
                    'ZJHM': '',
                    'LXDH': ''
                    })
                }
            }
        }

    
        for (var i in this.dyrList)
        {
          var dyr = this.dyrList[i];
          djry.push({
            'TYPE':'04',
            'RYLX': dyr.RYLX,
            'ZJLB': dyr.ZJLB,
            'MC': dyr.MC,
            'ZJHM': dyr.ZJHM,
            'LXDH': dyr.LXDH
          })
        }
        this.tip = "正在保存"
        this.submitLoading = true;
        this.$http({
              url: this.$http.adornUrl('/bdc/bdcfirstregist/' + path),
              method: 'post',
              data: this.$http.adornData({
                'seqno': this.seqno,
                'bld': this.dataForm.site,
                'seRegion': this.dataForm.seRegion,
                'region': this.dataForm.region,
                'djryList':djry,
                'xwblList': [{
                  'TYPE': '03',
                  'SFYYZS': this.dataForm.left1,
                  'SFGY': this.dataForm.left2
                },
                {
                  'TYPE': '04',
                  'SFYYZS': this.dataForm.right1,
                  'SFGY': this.dataForm.right2,
                  'SFZJYS': this.dataForm.right3,
                  'SFZJYZ': this.dataForm.right4
                }],
                'iszzyzb': this.dataForm.yzbfs,
             
                'isdygh': this.dataForm.dyghbs,
                'dbfw': this.dataForm.dbfw,
                'babsm': this.dataForm.babsm,
                'bdbzqse': this.dataForm.dbje,
                'zwlxqssj': this.dataForm.zwbegintime,
                'zwlxjssj': this.dataForm.zwendtime,
                'bdcxxList': this.dataForm.relatedBdcxx,
                'btype': this.btype,
                'htbaseqno': this.dataForm.seqno,
                'lzfs': '3',
                'isdzyxyw': this.dataForm.isdzyxyw,
                'fj': this.dataForm.fj
              })
            }).then(({data}) => {
              if (data && data.code === 0) {

                if (path == 'save'){
                  if (data.seqno && !this.seqno){
                    this.seqno = data.seqno
                  }                 
                }

                this.$message({
                  message:  path == 'saveComplete' ? '首次登记信息录入完成' : '首次登记信息保存成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {
                    if (path == 'saveComplete'){
                      this.visible = false
                      this.$emit('refreshDataList')
                    }
                  }
                })
              } else {
                this.$message.error(data.msg)
              }
              this.submitLoading = false;
            }) .catch(err => {
              this.submitLoading = false;
              console.error(err);
              this.$message.error('系统异常')              
            }); 
      },

      checkQwbFiles(){
        if (this.btype == '6'){
            if (this.$refs.upload30.uploadFiles.length == 0){
                this.$message.error("请上传文件编码30")
                return false;
            }

            if (this.$refs.upload3.uploadFiles.length == 0){
                this.$message.error("请上传文件编码03")
                return false;
            }

            if (this.$refs.upload7.uploadFiles.length == 0){
                this.$message.error("请上传文件编码07")
                return false;
            }
        }else{
          if (this.$refs.upload30.uploadFiles.length == 0){
                this.$message.error("请上传文件编码30")
                return false;
            }

            if (this.$refs.upload2.uploadFiles.length == 0){
                this.$message.error("请上传文件编码02")
                return false;
            }

            if (this.$refs.upload7.uploadFiles.length == 0){
                this.$message.error("请上传文件编码07")
                return false;
            }
        }
        return true;                    
      },



      // 表单提交
      save (isSubmit) {

        this.generateBtype()

        if (isSubmit){
                if (this.dataForm.left1 == ''){
                  this.$message.error("请选择抵押权人询问笔录是否为真实意思表示")
                  return;
                }

                if (this.dataForm.left2 == ''){
                  this.$message.error("请选择抵押权人询问笔录是否为共有房屋")
                  return;
                }

                if (this.dataForm.right1 == ''){
                  this.$message.error("请选择抵押人询问笔录是否为真实意思表示")
                  return;
                }

                if (this.dataForm.right2 == ''){
                  this.$message.error("请选择抵押人询问笔录是否为共有房屋")
                  return;
                }
                // if (this.btype == '6' || this.btype == '8'){
                //    if (!this.checkQwbFiles()){
                //      return;
                //    }
                // }
                // else if (this.btype == '7'){
                //     if (this.$refs.upload1.uploadFiles.length == 0){
                //         this.$message.error("请上传文件编码01")
                //         return;
                //     }

                //     if (this.$refs.upload3.uploadFiles.length == 0){
                //         this.$message.error("请上传文件编码03")
                //         return;
                //     }

                //     if (this.$refs.upload4.uploadFiles.length == 0){
                //         this.$message.error("请上传文件编码04")
                //         return;
                //     }
                //     if (this.$refs.upload7.uploadFiles.length == 0){
                //         this.$message.error("请上传文件编码07")
                //         return;
                //     }
                // }else if (this.btype == '9'){
                //     if (this.$refs.upload1.uploadFiles.length == 0){
                //         this.$message.error("请上传文件编码01")
                //         return;
                //     }

                //     if (this.$refs.upload2.uploadFiles.length == 0){
                //         this.$message.error("请上传文件编码02")
                //         return;
                //     }

                //     if (this.$refs.upload3.uploadFiles.length == 0){
                //         this.$message.error("请上传文件编码03")
                //         return;
                //     }
                //     if (this.$refs.upload7.uploadFiles.length == 0){
                //         this.$message.error("请上传文件编码07")
                //         return;
                //     }
                // }

        }

        if (isSubmit){
          this.$refs['dataForm'].validate((valid) => {
            if (valid) {
              var self = this
              this.checkDyqrPhone(function(){
                  self.commit('saveComplete');
              })
              
            }
            else{
              this.$message.error("参数校验失败")
            }
          })
        }else{
          this.commit('save');
        }


        
      }
    }
  }
</script>
<style>
.el-input.is-disabled .el-input__inner {
    background-color: #f5f7fa;
    border-color: #e4e7ed;
    color: #313b50;
    cursor: not-allowed;
}

.switch{
  float:right;
  margin-right:50px;

}

.wba{
  color:red;
  font-size: 16px;
}
</style>
